import java.util.Arrays;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String[] str=new String[4];
        for (int i = 0; i < 4; i++) {
            str[i]=sc.nextLine();
        }

        String sbb="";
        int count=0;
        for (int i = 0; i < 2; i++) {
            String[] sac=str[i].split(" ");
            for (int j = 0; j < sac.length; j++) {
                if(sac[j].equals(" ")==false){
                    if(sbb.contains(sac[j])==false){
                        sbb+=sac[j];

                    }
                }
            }
        }
         char[] arr1=new char[sbb.length()];
        for (int i = 0; i < sbb.length(); i++) {
            arr1[i]=sbb.charAt(i);
        }
        Arrays.sort(arr1);
        for (char x:
             arr1) {
            System.out.print(x+" ");
        }
        for (int i = 0; i < str[2].length(); i++) {  //后两个字符串选一个遍历，看另一个字符串包含不包含选择的字符串，包含就说明共有
            if(str[3].contains(str[2].charAt(i)+"")){

            }
        }
    }
}
